All Questions
16 questions
1vote
1answer
96views
Refactoring duplicated code with abstraction and generics
I have written simple command line project with Spring. And from what I think quality of code is pretty poor. I see what I could improve to remove duplicated code, but somehow I have no idea what ...
1vote
1answer
3kviews
Handling multiple optional parameters in Spring
I have an endpoint in my RestAPI which can receive 3 optional parameters and then find information in the database with these parameters, also it is possible to combine the parameters. So, in my ...
3votes
0answers
51views
Separation of database and network calls
I have a API and the corresponding service method is like this: ...
1vote
3answers
1kviews
User Id generator
Hi guys below is my code to generate random long unique Ids, I use System.nanoTime to generate long Id but now to make sure that it doesn't clash in the database with previously created Id I get all ...
2votes
1answer
116views
Copying notes takes a very long time
I am working on a Spring-MVC application in which we have note like functionality. Notes can have attachments, history, etc. There is a method to copy notes. When a note has a large number of ...
2votes
0answers
4kviews
Pagination using Spring MVC and Hibernate
My company develops a Spring web application that exposes a REST API and right now we're starting to look into pagination for the methods that load data from some heavy tables. We initially looked ...
1vote
1answer
6kviews
Map DTOs and Models within the Service Layer due to a missing Business Layer
The following is the story of a UserCredentialsDto that arrived at one of my endpoints and how it finds its way through all the layers namely REST Layer Service ...
0votes
1answer
1kviews
How to avoid duplicate code due to the impossibility of using multiple inheritance
I'm working on a Spring - Hibernate App, and I have a question about how to correctly avoid duplicate code and using Hibernate, due to the impossibility of using use multiple inheritance (I usually ...
0votes
1answer
46views
Implementation of getUsersWithStatuses based on getUsersWithStatus
In my code I have method which gets users from database with concrete status. And now I have to add new method which gets users from database with list of statuses. I don't know, is it better to ...
4votes
1answer
168views
Code for my first crud app
I would like to ask more experienced developers to review my code, it's my first app, self-made, I know there is a lot to improve, it would be great if you could just point the main errors. I'm ...
2votes
0answers
173views
Implementing a long-running entity lock
Requirement I have an entity named ImportData which can be processed once in order to extract data from a file fed to the application. I need to make sure that, in ...
3votes
1answer
6kviews
Customize data types in a generated model with hibernate
I have a Spring/Hibernate application with the following domain class (irrelevant code stripped for brevity): ...
1vote
1answer
63views
Retrieving three separate sorted lists of items
I need to search for records based on their area, postcode, city and sort each group ...
3votes
2answers
207views
Performance enhancement for collection manipulation
I have below snippet of code which gets all the available menu items for a zone(top or left)and adds the widgets for which user has access to an ArrayList collection. For now the getWidgetsByZone(zone)...
5votes
1answer
4kviews
Create better Base DAO class
I created a DAO class which is base class for all other DAO classes. I use Spring Framework 4 and Hibernate 4. Question: Is there anything that could be done better? ...